package net.cyue.easyconfiguration.toml.test.converter;

import net.cyue.easyconfiguration.node.api.INodeTypeConverter;
import net.cyue.web.easyquery.core.http.data.QueryParameter;

import java.util.Map;

public class Node2QueryParameterConverter implements INodeTypeConverter<Object, QueryParameter> {
    @Override
    public QueryParameter convert(Object value, String... path) {
        if (value instanceof String) {
            return new QueryParameter((String) value);
        } else if (value instanceof Map) {
            Map<String, Object> map = (Map<String, Object>) value;
            return new QueryParameter((String) map.get("name"));
        }
        return null;
    }
}
